package com.libary.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.libary.dto.Book;
import com.libary.service.Impl.BookServiceImpl;

@Controller(value = "book")
@RequestMapping(value = "book")
public class BookController {
	@Autowired
	private BookServiceImpl bookService;
	@RequestMapping(value = "/searchBookByName")
	public ModelAndView searchBookByName(@ModelAttribute Book namedBook){
		ModelAndView mav = new ModelAndView();
		mav.addObject("books", bookService.searchBooks(namedBook));
		mav.setViewName("SearchedBook");
		return mav;
	}
}
